import {ref} from 'vue'

/**
 * created by yangtong on 2025/6/16 下午11:02
 * <br />
 * 密码输入框专用逻辑
 */
export function usePasswordInput() {
    const showPassword = ref(false)

    const togglePasswordVisibility = () => {
        showPassword.value = !showPassword.value
    }

    const onMouseDown = () => {
        showPassword.value = true
    }

    const onMouseUp = () => {
        showPassword.value = false
    }

    const onMouseLeave = () => {
        showPassword.value = false
    }

    return {
        showPassword,
        togglePasswordVisibility,
        onMouseDown,
        onMouseUp,
        onMouseLeave
    }
}